use MSE6DB
go

delete [ServiceEngine].[Bindings]
go

delete [ServiceEngine].[Names] where EntityClass = 6
go

DECLARE @RC int
DECLARE @Name nvarchar(400)
DECLARE @BindingConfig xml
DECLARE @Description nvarchar(400)
DECLARE @ID uniqueidentifier

set @Name='BasicHttp (Soap11)'
set @BindingConfig = N'<bindings xmlns="">
  <basicHttpBinding>
    <binding name="basicHttp" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>'
set @Description = N'BasicHttp Binding with Soap11 Message Version. Please do not modify or delete as this is a system generated Binding used by different MSE system modules.'
set @ID = '{00000000-0000-0000-0000-B00000000001}'

EXECUTE @RC = [MSE6DB].[ServiceEngine].[CreateBinding] 
   @Name
  ,@BindingConfig
  ,@Description
  ,@ID OUTPUT


set @Name='BasicHttp (Soap12)'
set @BindingConfig = N'<bindings xmlns="">
  <customBinding>
    <binding name="svcSoap12">
      <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap12" writeEncoding="utf-8">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      </textMessageEncoding>
      <httpTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" />
    </binding>
  </customBinding>
</bindings>'
set @Description = N'BasicHttp Binding with Soap12 Message Version. Please do not modify or delete as this is a system generated Binding used by different MSE system modules.'
set @ID = '{00000000-0000-0000-0000-B00000000002}'

EXECUTE @RC = [MSE6DB].[ServiceEngine].[CreateBinding] 
   @Name
  ,@BindingConfig
  ,@Description
  ,@ID OUTPUT

set @Name='WsHttp (Soap11)'
set @BindingConfig = N'<bindings xmlns="">
  <customBinding>
    <binding name="wsHttpSoap11" >
    <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"  messageVersion="Soap11WSAddressing10" writeEncoding="utf-8">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      </textMessageEncoding> 
      <httpTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" />     
    </binding>
  </customBinding>
</bindings>'
set @Description = N'WsHttp Binding with Soap11 Message Version. Please do not modify or delete as this is a system generated Binding used by different MSE system modules.'
set @ID = '{00000000-0000-0000-0000-B00000000003}'

EXECUTE @RC = [MSE6DB].[ServiceEngine].[CreateBinding] 
   @Name
  ,@BindingConfig
  ,@Description
  ,@ID OUTPUT


set @Name='WsHttp (Soap12)'
set @BindingConfig = N'<bindings xmlns="">
  <wsHttpBinding>
    <binding name="wsHttp" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
      <security mode="None">
        <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
        <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>'
set @Description = N'WsHttp Binding with Soap12 Message Version. Please do not modify or delete as this is a system generated Binding used by different MSE system modules.'
set @ID = '{00000000-0000-0000-0000-B00000000007}'

EXECUTE @RC = [MSE6DB].[ServiceEngine].[CreateBinding] 
   @Name
  ,@BindingConfig
  ,@Description
  ,@ID OUTPUT


set @Name='NetNamedPipe'
set @BindingConfig = N'<bindings xmlns="">
  <netNamedPipeBinding>
    <binding name="NetPipe" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="Transport">
        <transport protectionLevel="EncryptAndSign" />
      </security>
    </binding>
  </netNamedPipeBinding>
</bindings>'
set @Description = 'NetNamedPipe Binding. Please do not modify or delete as this is a system generated Binding used by different MSE system modules.'
set @ID = '{00000000-0000-0000-0000-B00000000004}'

EXECUTE @RC = [MSE6DB].[ServiceEngine].[CreateBinding] 
   @Name
  ,@BindingConfig
  ,@Description
  ,@ID OUTPUT


set @Name='NetTcp'
set @BindingConfig = N'<bindings xmlns="">
  <netTcpBinding>
    <binding name="netTcp" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
      <security mode="Transport">
        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
        <message clientCredentialType="Windows" />
      </security>
    </binding>
  </netTcpBinding>
</bindings>'
set @Description = 'NetTcp Binding. Please do not modify or delete as this is a system generated Binding used by different MSE system modules.'
set @ID = '{00000000-0000-0000-0000-B00000000005}'

EXECUTE @RC = [MSE6DB].[ServiceEngine].[CreateBinding] 
   @Name
  ,@BindingConfig
  ,@Description
  ,@ID OUTPUT


set @Name='POX'
set @BindingConfig = N'<bindings xmlns="">
  <customBinding>
    <binding name="poxBinding">
      <textMessageEncoding messageVersion="None">
      </textMessageEncoding>
      <httpTransport>
      </httpTransport>
    </binding>
  </customBinding>
</bindings>'
set @Description = 'POX (Plain Old XML) Binding. Please do not modify or delete as this is a system generated Binding used by different MSE system modules.'
set @ID = '{00000000-0000-0000-0000-B00000000006}'

EXECUTE @RC = [MSE6DB].[ServiceEngine].[CreateBinding] 
   @Name
  ,@BindingConfig
  ,@Description
  ,@ID OUTPUT

set @Name='Microsoft Sql Server Binding'
set @BindingConfig = N'<bindings xmlns="" xmlns:mssql="clr-namespace:Microsoft.MSE.Runtime.Channels.SqlServer;assembly=Microsoft.MSE.Runtime.Channels.SqlServer"><customBinding><binding name="sqlBinding"><mssql:SqlServerElement /></binding></customBinding></bindings>'
set @Description = 'Microsoft Sql Server Binding. Please do not modify or delete as this is a system generated Binding used by different MSE system modules.'
set @ID = '{00000000-0000-0000-0000-B00000000008}'

EXECUTE @RC = [MSE6DB].[ServiceEngine].[CreateBinding] 
   @Name
  ,@BindingConfig
  ,@Description
  ,@ID OUTPUT

DECLARE @MonikerSchema xml
DECLARE @EditorAssembly nvarchar(max)
DECLARE @BindingID uniqueidentifier
DECLARE @EditorTypeName nvarchar(max)
--Create the default SQL Server Channel
--Please note that we only have a placeholder for moniker schema at this point
EXEC	@RC = [MSE6DB].[ServiceEngine].[CreateChannel]
		@Name = N'Microsoft Sql Server Default Channel',
		@BindingID = '{00000000-0000-0000-0000-b00000000008}',
		@MonikerSchema = N'<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://microsoft.com/mse/2007/runtime/channelModel"><xs:element name="ChannelModel"><xs:complexType><xs:sequence><xs:element name="ChannelModelElement"><xs:complexType><xs:sequence><xs:element name="ChannelModelElement.Address" type="xs:string" minOccurs="1" maxOccurs="1" /><xs:element name="ChannelModelElement.Action" type="xs:string" minOccurs="0" maxOccurs="1" /></xs:sequence></xs:complexType></xs:element></xs:sequence></xs:complexType></xs:element></xs:schema>',
		@EditorAssembly = N'For Future Use',
		@EditorTypeName = N'For Future Use',
		@Description = N'Microsoft Sql Server Default Chanel. Please do not modify or delete as this is a system generated Channel used by different MSE system modules.',
		@ID = '{00000000-0000-0000-0000-C00000000001}' 